﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartMathLibrary.Space.CoreTypes
{
    /// <summary>
    /// This class represents a general object.
    /// </summary>
    [Serializable]
    public class SpaceObject  : ISpaceEntry
    {
        private Object data;

        /// <summary>
        /// Initializes a new instance of the <see cref="SpaceObject"/> class.
        /// </summary>
        public SpaceObject(Object data)
        {
            this.data = data;
        }

        /// <summary>
        /// Gets or sets the value of the space object.
        /// </summary>
        /// <value>The value of the space object.</value>
        public object Data
        {
            get { return this.data; }
            set { this.data = value; }
        }

        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        public object Clone()
        {
            return CloneFunctions.Clone(this);
        }

        /// <summary>
        /// Compares the current <see cref="ISpaceEntry"/> to the specified <see cref="ISpaceEntry"/>.
        /// </summary>
        /// <param name="entry">The specified entry to compare.</param>
        /// <returns>
        /// If the object instances are even, the method returns true otherwise, false.
        /// </returns>
        public bool Equals(ISpaceEntry entry)
        {
            if (entry is SpaceObject)
            {
                SpaceObject check = (SpaceObject)entry;

                return check.Data.GetHashCode() == this.Data.GetHashCode();
            }

            return false;
        }

        /// <summary>
        /// Compares the current <see cref="ISpaceEntry"/> to the specified <see cref="ISpaceEntry"/>.
        /// </summary>
        /// <param name="entry">The specified entry to compare.</param>
        /// <returns>
        /// If the specified object instance is lower than the current instance the method returns true otherwise,
        /// false.
        /// </returns>
        public bool LowerThan(ISpaceEntry entry)
        {
            return false;
        }

        /// <summary>
        /// Compares the current <see cref="ISpaceEntry"/> to the specified <see cref="ISpaceEntry"/>.
        /// </summary>
        /// <param name="entry">The specified entry to compare.</param>
        /// <returns>
        /// If the specified object instance is greater than the current instance the method returns true otherwise,
        /// false.
        /// </returns>
        public bool GreaterThan(ISpaceEntry entry)
        {
            return false;
        }
    }
}